<?php
$this->breadcrumbs = array(
	'材料统计' => array(
		'materialStatistic/index'
	),
	'材料项目查询'
);
Yii::app()->clientScript
	->registerScript('search-material-project',
		"
var reloadStatistic=function(){
        var loading='努力计算中...';
        var formData=$('#material-project-search-form').serialize();
        var resultDiv=$('#material-project-statistic-result');
        resultDiv.html(loading);
        jQuery.get( '" . $this->createUrl('viewProjectResult')
			. "', formData,function(data){
			resultDiv.html(data);
        }, 'html' )
};

// $('#material-project-search-button').click(function(){
// 		reloadStatistic();
//         return false;
// });
");
?>
<h1>材料项目查询</h1>

<div class="form">
<?php $form = $this
	->beginWidget('CActiveForm',
		array(
			'id' => 'material-project-search-form',
			'action' => Yii::app()->createUrl($this->route),
			'method' => 'get',
		));
?>

	<?php echo $form->errorSummary($statisticForm); ?>
<fieldset>
<legend>搜索条件</legend>

	<div class="span-8">
		<?php echo $form->labelEx($statisticForm, 'projectId'); ?>
		<?php $this->widget('widgets.project.JProjectSelector',
				array(
					'model' => $statisticForm,
					'attribute' => 'projectId',
				));
		?>
	</div>
	<div class="span-10"><?php echo $form->labelEx($statisticForm, 'materialModelId'); ?>
		<?php
		$this
			->widget('widgets.material.JMaterialModelSelector',
				array(
					'model' => $statisticForm,
					'attribute' => 'materialModelId',
				));
		?></div>
	<div class="clear"></div>

	<div class="row buttons">
		<?php echo CHtml::submitButton('搜索',
			array(
				'id' => 'material-project-search-button'
			));
		?>
	</div>

</fieldset>
<?php $this->endWidget(); ?>
</div>
<?php if ($statisticForm->validate()) {

	Yii::app()->clientScript
		->registerScript('search-material-project-init', "
		reloadStatistic();
");
}
?>
<div id="material-project-statistic-result">
</div>
